home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
borland
/
tpwn31.zip
/
PASCAL.ZIP
/
PENWIN.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-04-06
|
35KB
|
1,166 lines
{*******************************************************}
{ }
{ Turbo Pascal for Windows Run-time Library }
{ Windows 3.1 API Interface Unit }
{ Pen Windows Interface unit }
{ }
{ Copyright (c) 1992 Borland International }
{ }
{*******************************************************}
unit PenWin;
{$S-}
interface
uses WinTypes, WinProcs, Win31;
{***** General Pen Windows Definitions ************************************}
type
TRec = Integer;
PSYV = ^TSYV;
TSYV = Longint;
THRec = THandle;
TCL = Integer;
TALC = Longint;
THKP = Word;
type
TDF = function(dirq: Integer; InP, OutP: Pointer; Max: Integer;
Context, Data : Longint): Integer;
const
BitPenup = $8000;
function FPenUp(X: LongInt): Boolean;
inline(
$58/ { POP AX }
$5A/ { POP DX }
$2D/$00/$80/ { SUB AX,8000H }
$1B/$C0/ { SBB AX,AX }
$40); { INC AX }
{ Default pen cursor to indicate writing, points northwest }
const
IDC_Pen = MakeIntResource(32631);
{ alternate select cursor: upsidedown standard arrow, points southeast }
const
IDC_AltSelect = MakeIntResource(32501);
const
rc_WDefault = $FFFF;
rc_Ldefault = $FFFFFFFF;
rc_WDefaultFlags = $8000;
rc_LDefaultFlags = $80000000;
{ HIWORD(SYV) defines and detection macros }
const
syvhi_Special = 0;
syvhi_ANSI = 1;
syvhi_Gesture = 2;
syvhi_Kanji = 3;
syvhi_Shape = 4;
syvhi_UniCode = 5;
syvhi_VKey = 6;
function FIsSpecial(syv: TSYV): Boolean;
function FIsAnsi(syv: TSYV): Boolean;
function FIsGesture(syv: TSYV): Boolean;
function FIsKanji(syv: TSYV): Boolean;
function FIsShape(syv: TSYV): Boolean;
function FIsUniCode(syv: TSYV): Boolean;
function FIsVKey(syv: TSYV): Boolean;
{ Macros to convert between SYV and ANSI }
function ChSyvToAnsi(syv: TSYV): Byte;
function SyvCharacterToSymbol(c: Char): TSYV;
function SyvKanjiToSymbol(c: Char): TSYV;
{ SYV values with special meanings to Pen Windows }
const
syv_Null = $00000000;
syv_Unknown = $00000001;
syv_Empty = $00000003;
syv_BeginOr = $00000010;
syv_EndOr = $00000011;
syv_Or = $00000012;
syv_SoftNewLine = $00000020;
syv_SpaceNull = $00010000;
{ SYV values for gestures (map into UNICODE space) }
const
syv_KKConvert = $0002FFD4;
syv_Clear = $0002FFD5;
syv_ExtendSelect = $0002FFD8;
syv_Undo = $0002FFD9;
syv_Copy = $0002FFDA;
syv_Cut = $0002FFDB;
syv_Paste = $0002FFDC;
syv_ClearWord = $0002FFDD;
syv_User = $0002FFDE; { Reserved }
syv_Correct = $0002FFDF;
syv_Backspace = $00020008;
syv_Tab = $00020009;
syv_Return = $0002000D;
syv_Space = $00020020;
function FIsStdGesture(syv: TSYV): Boolean;
function FIsAnsiGesture(syv: TSYV): Boolean;
{ Application specific gestures, Circle a-z and Circle A-Z }
const
syv_AppGestureMask = $00020000;
syv_CircleUpA = $000224B6;
syv_CircleUpZ = $000224CF;
syv_CircleLoA = $000224D0;
syv_CircleLoZ = $000224E9;
{ Gesture Macros }
function FIsLoAppGesture(syv: TSYV): Boolean;
function FIsUpAppGesture(syv: TSYV): Boolean;
function FIsAppGesture(syv: TSYV): Boolean;
function SyvAppGestureFromLoAnsi(Ansi: Char): TSYV;
function SyvAppGestureFromUpAnsi(Ansi: Char): TSYV;
function AnsiFromSyvAppGesture(syv: TSYV): Byte;
{ SYV definitions for shapes }
const
syv_ShapeLine = $00040001;
syv_ShapeEllipse = $00040002;
syv_ShapeRect = $00040003;
syv_ShapeMin = syv_ShapeLine;
syv_ShapeMax = syv_ShapeRect;
{***** Recognition Error Codes ********************************************}
const
rec_OEM = -1024;
rec_Language = -48;
rec_Guide = -47;
rec_ParamError = -46;
rec_InvalidRef = -45;
rec_RectExclude = -44;
rec_RectBound = -43;
rec_PCM = -42;
rec_ResultMode = -41;
rec_HWnd = -40;
rec_ALC = -39;
rec_ErrorLevel = -38;
rec_CLVerify = -37;
rec_Dict = -36;
rec_HRec = -35;
rec_BadEventRef = -33;
rec_NoCollection = -32;
rec_Debug = -32;
rec_PointerEvent = -31;
rec_BadHPenData = -9;
rec_OOM = -8;
rec_NoInput = -7;
rec_NoTablet = -6;
rec_Busy = -5;
rec_BufferTooSmall = -4;
rec_Abort = -3;
rec_Overflow = -1;
rec_OK = 0;
rec_TermBound = 1;
rec_TermEx = 2;
rec_TermPenUp = 3;
rec_TermRange = 4;
rec_TermTimeOut = 5;
rec_Done = 6;
rec_TermOEM = 512;
{***** Pen Driver Structures and Entry points *****************************}
type
POEMPenInfo = ^TOEMPenInfo;
TOEMPenInfo = record
wPdt: Word;
wValueMax: Word;
wDistinct: Word;
end;
const
pdt_Null = 0;
pdt_Pressure = 1;
pdt_Height = 2;
pdt_AngleXY = 3;
pdt_AngleZ = 4;
pdt_BarrelRotation = 5;
pdt_OEMSpecific = 16;
MaxOEMDataWords = 6;
type
PPenPacket = ^TPenPacket;
TPenPacket = record
wTabletX: Word;
wTabletY: Word;
wPDK: Word;
rgwOemData: array[0..MaxOEMDataWords - 1] of Word;
end;
type
TRawHook = function(PenPacket: PPenPacket): Bool;
type
PPenInfo = ^TPenInfo;
TPenInfo = record
cxRawWidth: Word;
cyRawHeight: Word;
wDistinctWidth: Word;
wDistinctHeight: Word;
nSamplingRate: Integer;
nSamplingDist: Integer;
lPdc: Longint;
cPens: Integer;
cbOemData: Integer;
rgoempeninfo: array[0..MaxOEMDataWords - 1] of TOEMPenInfo;
rgwReserved: array[0..7] of Word;
end;
const
pdc_Integrated = $00000001;
pdc_Proximity = $00000002;
pdc_Range = $00000004;
pdc_Invert = $00000008;
pdc_Relative = $00000010;
pdc_Barrel1 = $00000020;
pdc_Barrel2 = $00000040;
pdc_Barrel3 = $00000080;
type
PStrokeInfo = ^TStrokeInfo;
TStrokeInfo = record
cPnt: Word;
cbPnts: Word;
wPDK: Word;
dwTick: Longint;
end;
type
PCalbStruct = ^TCalbStruct;
TCalbStruct = record
wOffsetX: Integer;
wOffsetY: Integer;
wDistinctWidth: Integer;
wDistinctHeight: Integer;
end;
{***** DRV_ values for pen driver specific messages ***********************}
const
drv_SetPenDriverEntryPoints = drv_Reserved+1;
drv_RemovePenDriverEntryPoints = drv_Reserved+2;
drv_SetPenSamplingRate = drv_Reserved+3;
drv_SetPenSamplingDist = drv_Reserved+4;
drv_GetName = drv_Reserved+5;
drv_GetVersion = drv_Reserved+6;
drv_GetPenInfo = drv_Reserved+7;
drv_GetCalibration = drv_Reserved+11;
drv_SetCalibration = drv_Reserved+12;
procedure UpdatePenInfo(lpPenInfo: PPenInfo);
function EndPenCollection(recEnd: TRec): Bool;
function GetPenHwData(lpPnt: PPoint; lpvOemData: Pointer; cPntMax: Integer;
wTimeOut: Word; lpsi: PStrokeInfo): TRec;
function GetPenHwEventData(wEventRefBeg: Word; wEventRefEnd: Word;
lpPnt: PPoint; lpvOemData: Pointer; cPntMax: Integer; lpsi: PStrokeInfo): TRec;
(*